#pragma once

#include "D3DUtils.h"
#include "Component.h"

class Sprite :
	public Component
{
public:
	Sprite();
	Sprite(std::string path);
	Sprite(std::string path, float _posX, float _posY);
	
	virtual ~Sprite();

	void SetPosition(float x, float y);
	void SetPositionX(float x);
	void SetPositionY(float y);
	void SetCenter(float, float);
	void SetSrcRect(RECT& srcRect);

	D3DXVECTOR3 GetPosition(){ return mPosition; }
	float GetPositionX(){ return mPosition.x; }
	float GetPositionY(){ return mPosition.y; }

	void SetRotationY(float angleY){ D3DXMatrixRotationY(&mRotation, angleY); }
	void SetRotationX(float angleX){ D3DXMatrixRotationX(&mRotation, angleX); }
	void SetRotationZ(float angleZ){ D3DXMatrixRotationZ(&mRotation, angleZ); }
	void SetRotationYawPitchRoll(float yaw, float pitch, float roll){ D3DXMatrixRotationYawPitchRoll(&mRotation, yaw, pitch, roll); }

	bool Sprite::SetTexture(const char *szTextureFilePath, D3DCOLOR dwKeyColour);
	
	virtual void Update(double dt);
	virtual void Draw(ID3DXSprite& sprite);

protected:
	void LoadTexture(std::string path);

	IDirect3DTexture9* mTexture;
	D3DXVECTOR3 mCenter;
	D3DXVECTOR3 mPosition;
	RECT srcRect;
	D3DXIMAGE_INFO imgInfos;
	D3DXMATRIX mTranslation;
	D3DXMATRIX mRotation;
};